import { useAppDispatch } from '@/hooks';
import { getFIndByParentIdAsync, useSelectorDict } from '@/store/slice/dict';
import { Table } from 'antd';
import React, { useEffect } from 'react';

function Dict() {
    const dispatch = useAppDispatch();
    const { dictList } = useSelectorDict();
    useEffect(() => {
        dispatch(getFIndByParentIdAsync(1))
    }, [])
    return (
        <div>
            <Table
                columns={[
                    {
                        title: "名称",// 表格列的标头
                        dataIndex: "name",// 会将dataSource数组中元素（对象）的name属性输出
                    }, {
                        title: "编码",
                        dataIndex: "dictCode"
                    }, {
                        title: "值",
                        dataIndex: "value"
                    }, {
                        title: "创建时间",
                        dataIndex: "createTime"
                    }
                ]}
                // 不显示分页
                pagination={false}
                // 唯一标识
                rowKey={"id"}
                // 数据数组
                dataSource={dictList}
            ></Table>
        </div>
    );
}


export default Dict;